package com.example.mykotlinapp

/**
 *
 *
 * @author zhudeshuai
 * @since 2019/7/5
 */

//flatMap和flatten
data class Book(val title: String, val authors: List<String>)


private fun main() {
    val authorsList1 = listOf("Jack","Helen","Iry")
    val authorsList2 = listOf("Jack","Tom","Curry")
    val books = listOf(Book("Deep in Java", authorsList1), Book("C++", authorsList2))
    println(books.flatMap { it.authors }.toSet())
}